﻿@model Apps.Models.Sys.SysStructModel
@using Apps.Common;
@using Apps.Models.Sys;
@using Apps.Web.Core;
@using Apps.Locale;
@{
    ViewBag.Title = "创建";
    Layout = "~/Views/Shared/_Index_LayoutEdit.cshtml";
    List<permModel> perm = null;
}

<script type="text/javascript">
    $(function () {
        $("#btnSave").click(function () {
            if ($("form").valid()) {
                $.ajax({
                    url: "@Url.Action("Create")",
                    type: "Post",
                    data: $("form").serialize(),
                    dataType: "json",
                    success: function (data) {
                        if (data.type == 1) {
                            window.parent.frameReturnByMes(data.message);
                            window.parent.frameReturnByReload(true);
                            window.parent.frameReturnByClose()
                        }
                        else {
                            window.parent.frameReturnByMes(data.message);
                        }
                    }
                });
            }
            return false;
        });
        $("#btnReturn").click(function () {
            window.parent.frameReturnByClose();
        });
    });
</script>
<div class="mvctool bgb">
    @Html.ToolButton("btnSave", "fa fa-save", Resource.Save, ref perm, "Save", true)
    @Html.ToolButton("btnReturn", "fa fa-reply", Resource.Reply, false)
</div>
@using (Html.BeginForm())
{
    @Html.HiddenFor(model => model.Id)
    <input id="CreateTime" type="hidden" name="CreateTime" value="2000-1-1" />
            <table class="formtable">
                <tbody>
                    <tr>
                        <th>
                            @Html.LabelFor(model => model.Name, 0)：
                        </th>
                        <td>
                            @Html.EditorFor(model => model.Name)
                        </td>
                    </tr>
                    <tr>
                        <th>
                            @Html.LabelFor(model => model.ParentId, 0)：
                        </th>
                        <td>
                            <div id="ParentControl">

                            </div>
                            <script type="text/javascript">
                                $(function () {
                                    $("#ParentControl").load("@Url.Action("_StructParentSelect")?ControlID=ParentId&ControlName=ParentId&SelectValue=@Model.ParentId&CurrentID=");
                                });
                            </script>
                        </td>
                    </tr>
                    <tr>
                        <th>
                            @Html.LabelFor(model => model.Sort, 0)：
                        </th>
                        <td>
                            @Html.EditorFor(model => model.Sort)
                        </td>
                    </tr>

                    <tr>
                        <th>
                            @Html.LabelFor(model => model.Enable, 0)：
                        </th>
                        <td>
                            @Html.CheckBoxFor(model => model.Enable, new { @checked = true })
                        </td>
                    </tr>
                    <tr>
                        <th>
                            @Html.LabelFor(model => model.Remark, 0)：
                        </th>
                        <td>
                            <textarea class="text-box multi-line" id="Remark" name="Remark" style="margin: 0px; width: 270px; height: 50px;"></textarea>
                        </td>
                    </tr>
                </tbody>
            </table>
            @Html.ValidationSummary()
}
